<?php
session_start();
include("../includes/conn.php");
$dbconn->admin_logincheck();
$username =  isset($_GET['username'])?$_GET['username']:'';
$province = isset($_GET['province'])?$_GET['province']:'';
$name = isset($_GET['name'])?$_GET['name']:'';
$time = isset($_GET['time'])?$_GET['time']:'';
$where = '1';
if($username)
{
	$where .= ' and '.DBQIAN.'users.username=\''.$username.'\'';
}
if($province)
{
	$where .= ' and '.DBQIAN.'users.province=\''.$province.'\'';
}
if ($name)
{
	$where .= ' and '.DBQIAN.'users.name=\''.$name.'\'';
}
if ($time)
{
	$where .= ' and '.DBQIAN.'users.createtime >=\''.$time.'\' and '.DBQIAN.'users.createtime <=\''.substr($time,0,10).' 23:59:59\'';
}
//echo $where;exit;
if($_GET['act']=='del'){
$id=intval($_GET['id']);
$dbconn->noretquery("delete from ".DBQIAN."users where id=$id");
header("Location: hyrecord.php?page=$_GET[page]");
};
if($_GET['act']=='audit'){
$id=intval($_GET['id']);
$dbconn->noretquery("update ".DBQIAN."users set status=1 where id=$id");
header("Location: hyrecord.php?page=$_GET[page]");
};
if ($_GET['act'] == 'trucate')
{
	$dbconn->noretquery("TRUNCATE TABLE ".DBQIAN."users");
	header("Location: hyrecord.php");
}
echo '<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>欢迎登录后台管理系统</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<link href="css/right.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
<script language="JavaScript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery-ui-slide.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script>
$(document).ready(function(){
   $(function(){
   		$(\'#time\').datetimepicker();
      $(\'.rightinfo tbody tr:odd\').css("backgroundColor","#f5f8fa");
   });
});
</script>
<style type="text/css">
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px;}
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui_tpicker_hour_label,.ui_tpicker_minute_label,.ui_tpicker_second_label,.ui_tpicker_millisec_label,.ui_tpicker_time_label{padding-left:20px}
</style>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="index.php">首页</a></li>
    <li>导购资料</li>
  </ul>
</div>
<div class="rightinfo">
	<div> 
	<form action="" method="get" style="font-size:14px;font-weight:bolder;">
		手机: <input type="text" name="username" value="';echo $_GET['username'];;echo '" size="25" placeholder="手机号" style="text-align:center;border:1px solid #000;height:28px;border-radius:4px; background:#eeeeee;" /> &nbsp;&nbsp;
		省份: <input type="text" name="province" value="';echo $_GET['province'];;echo '" size="30" placeholder="省份" style="text-align:center;border:1px solid #000;height:28px;border-radius:4px; background:#eeeeee;" /> &nbsp;&nbsp;
		姓名: <input type="text" name="name" value="';echo $_GET['name'];;echo '" size="30" placeholder="姓名" style="text-align:center;border:1px solid #000;height:28px;border-radius:4px;background:#eeeeee;" /> &nbsp;&nbsp;
		注册时间: <input type="text" name="time" id="time" value="';echo $_GET['time'];;echo '" size="30" placeholder="" style="text-align:center;border:1px solid #000;height:28px;border-radius:4px;background:#eeeeee;" /> &nbsp;&nbsp;
		<input type="submit" name="submit" value="查询" style="width:60px; text-align:center;border:1px solid #000;height:28px;border-radius:4px; background:#b6cad2;" /> &nbsp;&nbsp;
	</form><br/>
	</div>
  <div class="tools"> 
    <ul class="toolbar">
	  <li><a href="hyrecord_add.php"><span><img src="images/t01.png" /></span>添加</a></li> 
      <li><a href="excel.hyrecord.php"><span><img src="images/ico03.png" /></span>导出</a></li> 
      <li><a onClick="if(confirm(\'您确认要清空吗？\')){location.href=\'?act=trucate\'}" href="#"><span><img src="images/t03.png" /></span>清空记录</a></li>

    </ul>
  </div>
  <table class="tablelist">
    <thead>
      <tr>
        <th width="6%">手机</th>
        <th width="7%">真实姓名</th>
        <th width="4%">性别</th>
        <th width="10%">余额</th>
        <th width="8%">省份</th>
        <th width="9%">市</th>
        <th width="12%">注册时间</th>
        <th width="16%">微信Openid</th>
        <th width="14%">操作</th>
      </tr>
    </thead>
    <tbody>
      ';
$page = ($_GET['page'] == ''||!isset($_GET['page'])) ?1:$_GET['page'];
$pagesize=12;
$num=$dbconn->countn(DBQIAN."users",$where);//获取数据条数
$pagelist = new page($page,$pagesize,$num ,10,2,0);
$query=$dbconn->news_list(" select * from ".DBQIAN."users where ".$where." order by province desc ",$page,$pagesize);
while($row=$dbconn->fetch($query)){
//$urow=$dbconn->fetch($dbconn->query("select * from ".DBQIAN."users where username='$row[username]'"));
;echo '      
		<tr height="45">
	        <td>';echo $row['username'];echo '</td>
	        <td>';echo $row['name'];echo '</td>
	        <td>';
				if($row['sex']=='') echo '未知';
				if($row['sex']=='男') echo '男';
				if($row['sex']=='女') echo '女';
				;echo 
			'</td>
	        <td>';echo $row['credit'];;echo '</td>
	        <td>';echo $row['province'];;echo '</td>
	         <td>';echo $row['city'];;echo '</td>
			<td>';echo $row['createtime'];;echo '</td>
	         <td>';echo $row['openid'];;echo '</td>
	        <td>
	          <img src="images/t03.png" width="14"> 
	          <a onClick="if(confirm(\'您确认要删除吗？\')){window.location.href=\'?act=del&id=';echo $row['id'];echo '&page=';echo $page;echo '\'}" href="#" class="tablelink">删除</a>
	         <img src="images/ice.png" width="14"> 
	          <a onClick="if(confirm(\'您确认要编辑吗？\')){window.location.href=\'hyrecord_edit.php?act=edit&id=';echo $row['id'];echo '&page=';echo $page;echo '\'}" href="#" class="tablelink">编辑</a>
	        </td>
      </tr>
          ';
//if($row['xtype']==2){echo "奖励红包";};echo '        </td>
//       
//      ';
}
;echo '    </tbody>
  </table>
</div>
<div style=" width:90%; padding:10px 0 10px 0; text-align:center">
  ';if($num!=0) echo $pagelist->showpages();else echo "<font color='#ff0000'>暂无数据</font>";;echo '</div>
</body>
</html>'
?>